class ReviewTypesController < ApplicationController
  # GET /review_types
  def index
    @review_types = ReviewType.all
  end
  
  # GET /review_types/new
  def new
    @review_type = ReviewType.new
  end

  # POST /review_types
  def create
    @review_type=ReviewTypeFactory.new.build(params)
    
    if @review_type.save
      set_notice 'created'
      redirect_to review_types_url
    else
      render action: "new" 
    end
  end

  # DELETE /review_types/1
  def destroy
    @review_type = ReviewType.find(params[:id])
    @review_type.destroy

    set_notice 'deleted'
    redirect_to review_types_url
  end

  def set_notice(action)
    flash[:notice]='The review type "'+@review_type.title+'" was successfully '+action+'.'
  end

end
